treeview: Fix prelight redraw when adjustment changes
authorAlexander Larsson <alexl@redhat.com>
Tue, 29 Apr 2014 07:08:31 +0000 (09:08 +0200)
committerAlexander Larsson <alexl@redhat.com>
Tue, 29 Apr 2014 07:12:02 +0000 (09:12 +0200)
When the adjustment changes (due to e.g. a mouse wheel scroll) we update
the prelight. The part that un-prelights the previous prelight was
broken by the the pixel cache, as it called update_prelight in the
middle of the scrolling operation, where the windows were moved
but the tree_view->priv->dy was not changed to the new value. This
caused the updates to the pixel cache to go to the wrong place.

We fix this by fully doing the scroll before we update_prelight().

https://bugzilla.gnome.org/show_bug.cgi?id=728284

gtk/gtktreeview.c

index 146925469479e529574747f0807498f84f9c478e..9c0676287bbd1fbb57fe1c5311d097ea085627bd 100644 (file)
@@ -11218,24 +11218,23 @@ gtk_tree_view_adjustment_changed (GtkAdjustment *adjustment,
                       - gtk_adjustment_get_value (tree_view->priv->hadjustment),
                       0);
       dy = tree_view->priv->dy - (int) gtk_adjustment_get_value (tree_view->priv->vadjustment);
-      if (dy)
-       {
-          update_prelight (tree_view,
-                           tree_view->priv->event_last_x,
-                           tree_view->priv->event_last_y - dy);
-       }
       tree_view->priv->in_scroll = TRUE;
       gdk_window_scroll (tree_view->priv->bin_window, 0, dy);
       tree_view->priv->in_scroll = FALSE;
 
-      if (tree_view->priv->dy != (int) gtk_adjustment_get_value (tree_view->priv->vadjustment))
+      if (dy != 0)
         {
           /* update our dy and top_row */
           tree_view->priv->dy = (int) gtk_adjustment_get_value (tree_view->priv->vadjustment);
 
+          update_prelight (tree_view,
+                           tree_view->priv->event_last_x,
+                           tree_view->priv->event_last_y);
+
           if (!tree_view->priv->in_top_row_to_dy)
             gtk_tree_view_dy_to_top_row (tree_view);
-       }
+
+        }
     }
 }